package com.mayikt.swagger.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.stereotype.Component;

/**
 * 秒杀服务
 */
@Component
public class SeckillService {

    @SentinelResource(value = "seckill", blockHandler = "getSeckillQpsException")
    public String seckill(String userPhone, String seckillId) throws Exception {
        return "success";
    }

    public String getSeckillQpsException(String userPhone, String seckillId, BlockException e) throws Exception {
        throw new RuntimeException();
    }
}
